Release 10.1A: OpenEdge Development:
.NET Open Clients


Unknown value (?)

Unknown value (?) is mapped to a null value for a .NET reference type (class); however, the .NET value types (System.Boolean, System.Decimal, System.Int32, System.Int64, and System.DateTime) always have a default value, and the null value does not belong to the set of values they support. For each of these value types, OpenEdge provides a holder class, which can be set to a null value, in the Progress.Open4GL namespace. In ProxyGen, if you specify that one of these parameters can accept the Unknown value (?), the method is defined with the corresponding holder class; otherwise the parameter is defined using the .NET value type.

This is an example of a C# proxy method signature that does not support Unknown value (?) for the first and third parameters:

foo(int i, string s, bool b) 

This is an example of a C# proxy method that allows all the parameter values to have Unknown value (?):

foo(IntHolder i, string s, BooleanHolder b) 

Holder classes

For each Progress data type that maps to a .NET value type, there is a Holder class. These Holder classes belong to the Progress.Open4GL namespace and extend the Progress.Open4GL.Holder class, shown in Table 4–3.

Table 4–3: Holder class definitions 
Class
Constructors
Property
BooleanHolder 
BooleanHolder() 
BooleanHolder(bool value) 
System.Boolean
   BooleanValue; 
DateHolder 
DateHolder() 
DateHolder(System.DateTime value) 
System.DateTime 
   DateValue; 
DecimalHolder 
DecimalHolder(decimal value) 
DecimalHolder(double value) 
System.Decimal 
   DecimalValue; 
IntHolder 
IntHolder() 
IntHolder(int value) 
System.Int32 IntValue; 
LongHolder 
LongHolder() 
LongHolder(long value) 
System.Int64 LongValue; 

Table 4–4 shows 4GL-to-.NET value-type mappings for parameters that have a default mapping that cannot accept Unknown value (?). These 4GL types are mapped to classes in the Progress.Open4GL namespace, as shown in the table.

Table 4–4: Progress 4GL-to-.NET value-type mappings
Progress 4GL
.NET
DATE
DATETIME
DATETIME-TZ 
Progress.Open4GL.DateHolder 
DECIMAL 
Progress.Open4GL.DecimalHolder 
INTEGER 
Progress.Open4GL.IntHolder 
LOGICAL 
Progress.Open4GL.BooleanHolder 
RECID 
Progress.Open4GL.LongHolder 

Setting an INPUT or INPUT/OUTPUT parameter to unknown

For INPUT or INPUT-OUTPUT parameters, you can set an input value to the Unknown value (?) by setting Value=null on the holder object.

For example, in C#, to set the value of a holder object to unknown, use the Value property:

Holder.Value=null 

Testing an INPUT/OUTPUT or OUTPUT parameter for unknown

For OUTPUT and INPUT-OUTPUT parameters, you can find out whether an unknown output value is returned by testing if the IsNull property is true or the Value property on the holder object equals null.

For example, in C#, to test the value of a holder object, check the isNULL or Value property:

if (Holder.isNull)  
        — OR — 
if (Holder.Value == null)  


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095